package com.totoro.mybatis.mul_datasource.dao.school;

import com.totoro.mybatis.mul_datasource.domain.School;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;

/**
 * Created by Niki on 2018/8/15 15:00
 */
@Mapper
public interface SchoolDao {

    @Select("select *from school where id = #{school}")
    School findById(int id);

    @Insert("insert into school(name, code) values(#{name},#{code})")
    @SelectKey(keyProperty = "id",keyColumn = "id",resultType = Integer.class,before = false,statement = "select last_insert_id()")
    int insertSchool(School school);
}
